package cn.xm.lingshi.dao.impl;

import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;

import cn.xm.lingshi.dao.FlavourDao;
import cn.xm.lingshi.pojo.Flavour;
import cn.xm.lingshi.utlis.BaseDao;

public class FlavourDaoImpl extends BaseDao implements FlavourDao {

	@Override
	public List<Flavour> requstflav() throws Exception {
		String sql = "SELECT flaid,flaname FROM flavour";
		ResultSet rs = super.executeQuery(sql, null);
		List<Flavour> list = new ArrayList<Flavour>();
		Flavour flavour=null;
		while (rs != null && rs.next()) {
			flavour=new Flavour();
			flavour.setFlavid(rs.getInt("flaid"));
			flavour.setFlavour(rs.getString("flaname"));
			list.add(flavour);
		}
		return list;
	}

	public static void main(String[] args) {
		List<Flavour> list=new ArrayList<Flavour>();
		FlavourDaoImpl s=new FlavourDaoImpl();
		try {
			list=s.requstflav();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		for (Flavour ss : list) {
			System.out.println(ss.getFlavour());
		}
	}
}
